const http = require("http");
const url = require("url");
const querystring = require("querystring");

http.createServer((req, res) => {
    // let statusObj = {"status": "ok"};
    let path = new url.URL(req.url, "http://192.168.42.166:3000");
    console.log(path.pathname);
    let arr = url.parse(req.url).query;
    console.log(arr);
    console.log(querystring.parse(arr));
    let statusObj = querystring.parse(arr);

    let userName = path.searchParams.get("username");
    let age = path.searchParams.get("age");
    console.log(userName , age);
    res.end(JSON.stringify(statusObj));
}).listen(3000)

console.log("server is listening 3000");